package net.self.kafka.consumer;

public class KafkaProducerConfig {

        public final static String BOOTSTRAP_SERVERS="localhost:9092";
        /**
         * The default kafka topic for receiving user's processMessage.
         */
        public final static String A10_METADATA_TOPIC = "__metadata";

        /*
        * 指定server等待来自followers的确认的最大时间，根据acks的设置，超时则返回error
        * */
        public final static int TIMEOUT_MS = 10000;

        /*
        *client等待请求响应的最大时间,如果在这个时间内没有收到响应，客户端将重发请求，超过重试次数发送失败
        * */
        public final static int REQUEST_TIMEOUT_MS = 5000;

        /*
        *	连接失败时，当我们重新连接时的等待时间
        * */
        public final static long  RECONNECT_BACKOFF_MS = 50;

        /*
        * 在重试发送失败的request前的等待时间
        * */
        public final static long RETRY_BACKOFF_MS = 100;

        public final static int BATCH_SIZE = 16283;

        public final static int LINGER_MS = 1;

        public final static int BUFFER_MEMORY = 33554432;

        /**
         * This value controls when a produce request is considered completed.
         * 0: If set to zero then the producer will not wait for any acknowledgment from the server at all. The record will be immediately added to the socket buffer and considered sent. No guarantee can be made that the server has received the record in this case, and the retries configuration will not take effect (as the client won't generally know of any failures). The offset given back for each record will always be set to -1.
         * 1: This will mean the leader will write the record to its local log but will respond without awaiting full acknowledgement from all followers. In this case should the leader fail immediately after acknowledging the record but before the followers have replicated it then the record will be lost.
         * all: This means the leader will wait for the full set of in-sync replicas to acknowledge the record. This guarantees that the record will not be lost as long as at least one in-sync replica remains alive. This is the strongest available guarantee.
         */
        public final static String KAFKA_REQUEST_REQUIRED_ACKS = "1";

        /**
         * Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error. Note that this retry is no different than if the client resent the record upon receiving the error. Allowing retries will potentially change the ordering of records because if two records are sent to a single partition, and the first fails and is retried but the second succeeds, then the second record may appear first.
         */
        public final static int KAFKA_RETRIES = 3;

        public final static String KEY_SERIALIZER = "org.apache.kafka.common.serialization.StringSerializer";

        public final static String VALUE_SERIALIZER = "org.apache.kafka.common.serialization.StringSerializer";


}
